﻿using System.Windows.Controls;

namespace Plugins.UserControls
{
    public partial class StockSelector : UserControl
    {
        #region Properties

        public new StockSelectorVM DataContext
        {
            get
            {
                return (StockSelectorVM)base.DataContext;
            }
            set
            {
                if (this.DataContext != value)
                {
                    base.DataContext = value;
                }
            }
        }
        
        #endregion

        #region Public Methods

        public StockSelector()
        {
            InitializeComponent();
        }

        #endregion

        #region Event Handlers

        private void ComboBox_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (this.DataContext.RefreshStocksAvailable.CanExecute(null))
            {
                this.DataContext.RefreshStocksAvailable.Execute(null);
            }
        }

        #endregion
    }
}
